import pytest
def add (x,y):
    return x+y
class TestAdd:
    @pytest.mark.parametrize("x,y,expect",[(1,1,2),(1,0,1),(0,0,0)])
    def test_add1(self,x,y,expect):
        print(f"x={x},y={y},expect={expect}")
        result = add(x,y)
        assert result == expect

# 构造测试数据
def build_data():
    return [(1,1,2),(1,0,100),(0,0,0)]
class TestAdd1:
    @pytest.mark.parametrize("x,y,expect",build_data())
    def test_add1(self, x, y, expect):
        print(f"x={x},y={y},expect={expect}")
        result = add(x, y)
        assert result == expect